package com.zhanglijie.theory.future;

/**
 * @author zhanglijie
 * @version 1.0
 * @since 1.1.0 2022/8/14 0014 23:52
 */
public class Server {
    public Product request(int count,char c){
        System.out.println("####开始请求了 count is "+count+" c is "+c);
        FutureProduct futureProduct = new FutureProduct();
        new Thread(()->{
            RealProduct realProduct = new RealProduct(count,c);
            //这里会有争抢
            futureProduct.setRealProduct(realProduct);
        }).start();
        System.out.println("######结束请求了 count is "+count+" c is "+c);
        return futureProduct;
    }
}
